home *** CD-ROM | disk | FTP | other *** search
/ 9-Digit Zip Code Directory / 9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO / z4src.zip / PGCHART.H < prev    next >
C/C++ Source or Header  |  1993-11-23  |  10KB  |  257 lines

  1. /***
  2. *pgchart.h - Declare constants, functions and macros for charting library.
  3. *
  4. *  Copyright (c) 1988-1992, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *  This file declares the presentation graphics library functions and
  8. *  the structures and manifest constants that are used with them.
  9. *
  10. ***************************************************************************/
  11.  
  12.  
  13. #ifdef __cplusplus
  14. extern "C" {                /* allow use with C++ */
  15. #endif
  16.  
  17. #if (_MSC_VER <= 600)
  18. #define    __cdecl    _cdecl
  19. #define    __far    _far
  20. #endif
  21.  
  22. /* Force word alignment to avoid possible -Zp override */
  23. #pragma    pack(2)
  24.  
  25.  
  26. /* Required for the missing value definition */
  27. #ifndef    FLT_MAX
  28. #define FLT_MAX            3.402823466e+38F    /* max value */
  29. #endif
  30.  
  31. #define _PG_PALETTELEN        16    /* Number of entries in internal palette */
  32. #define _PG_MAXCHARTTYPE    5    /* Maximum available chart type */
  33. #define _PG_MAXCHARTSTYLE    2    /* Maximum chart style */
  34. #define _PG_TITLELEN        70    /* Maximum title text length */
  35.  
  36. #define _PG_LEFT        1    /* Positions used for titles and legends */
  37. #define _PG_CENTER        2
  38. #define _PG_RIGHT        3
  39. #define _PG_BOTTOM        4
  40. #define _PG_OVERLAY        5
  41.  
  42. #define _PG_LINEARAXIS        1    /* Used to specify axis types */
  43. #define _PG_LOGAXIS        2
  44.  
  45. #define _PG_DECFORMAT        1    /* Used to specify tic mark label format */
  46. #define _PG_EXPFORMAT        2
  47.  
  48. #define _PG_BARCHART        1    /* Charttype for a bar chart */
  49. #define _PG_COLUMNCHART        2    /* Charttype for a column chart */
  50. #define  _PG_PLAINBARS        1    /* Styles for bar and column charts */
  51. #define  _PG_STACKEDBARS    2
  52.  
  53. #define _PG_LINECHART        3    /* Charttype for a line chart */
  54. #define _PG_SCATTERCHART    4    /* Charttype for a scatter chart */
  55. #define _PG_POINTANDLINE    1    /* Styles for line and scatter charts */
  56. #define _PG_POINTONLY        2
  57.  
  58. #define _PG_PIECHART        5    /* Charttype for pie chart */
  59. #define _PG_PERCENT        1    /* Styles for pie charts */
  60. #define _PG_NOPERCENT        2
  61.  
  62. #define _PG_MISSINGVALUE    (-FLT_MAX) /* Indicates missing data values */
  63.  
  64.  
  65. /* Error codes */
  66.  
  67. /* Numbers greater than 100 will terminate chart routine, others will cause
  68.  * default values to be used
  69.  */
  70. #define    _PG_NOTINITIALIZED    102    /* If library not initialized */
  71. #define    _PG_BADSCREENMODE    103    /* Graphics mode not set before charting */
  72. #define    _PG_BADCHARTSTYLE    04    /* Chart style invalid */
  73. #define    _PG_BADCHARTTYPE    104    /* Chart type invalid */
  74. #define    _PG_BADLEGENDWINDOW    105    /* Invalid legend window specified */
  75. #define    _PG_BADCHARTWINDOW    07    /* x1=x2 or y1=y2 in chart window spec. */
  76. #define    _PG_BADDATAWINDOW    107    /* If chart window is too small */
  77. #define    _PG_NOMEMORY        108    /* Not enough memory for data arrays */
  78. #define    _PG_BADLOGBASE        05    /* Log base <= 0 */
  79. #define    _PG_BADSCALEFACTOR    06    /* Scale factor = 0 */
  80. #define    _PG_TOOSMALLN        109    /* Number of data points <= 0 */
  81. #define    _PG_TOOFEWSERIES    110    /* Number of series <= 0 */
  82.  
  83.  
  84. /* Typedefs */
  85.  
  86. /* Typedef for chart title */
  87. #ifndef _TITLETYPE_DEFINED
  88. typedef    struct    {
  89.     char    title[_PG_TITLELEN];    /* Title text */
  90.     short    titlecolor;        /* Internal palette color for title text */
  91.     short    justify;        /* _PG_LEFT, _PG_CENTER, _PG_RIGHT */
  92. } _titletype;
  93. #define _TITLETYPE_DEFINED
  94. #endif
  95.  
  96. /* Typedef for chart axes */
  97. #ifndef _AXISTYPE_DEFINED
  98. typedef    struct    {
  99.     short        grid;        /* TRUE=grid lines drawn; FALSE no lines */
  100.     short        gridstyle;    /* Style number from style pool for grid lines */
  101.     _titletype    axistitle;    /* Title definition for axis */
  102.     short        axiscolor;    /* Color for axis */
  103.     short        labeled;    /* TRUE=tic marks and titles drawn */
  104.     short        rangetype;    /* _PG_LINEARAXIS, _PG_LOGAXIS */
  105.     float        logbase;    /* Base used if log axis */
  106.     short        autoscale;    /* TRUE=next 7 values calculated by system */
  107.     float        scalemin;    /* Minimum value of scale */
  108.     float        scalemax;    /* Maximum value of scale */
  109.     float        scalefactor;    /* Scale factor for data on this axis */
  110.     _titletype    scaletitle;    /* Title definition for scaling factor */
  111.     float        ticinterval;    /* Distance between tic marks (world coord.) */
  112.     short        ticformat;    /* _PG_EXPFORMAT or _PG_DECFORMAT for tic labels */
  113.     short        ticdecimals;    /* Number of decimals for tic labels (max=9)*/
  114. } _axistype;
  115. #define _AXISTYPE_DEFINED
  116. #endif
  117.  
  118. /* Typedef used for defining chart and data windows */
  119. #ifndef _WINDOWTYPE_DEFINED
  120. typedef    struct    {
  121.     short        x1;        /* Left edge of window in pixels */
  122.     short        y1;        /* Top edge of window in pixels */
  123.     short        x2;        /* Right edge of window in pixels */
  124.     short        y2;        /* Bottom edge of window in pixels */
  125.     short        border;        /* TRUE for border, FALSE otherwise */
  126.     short        background;    /* Internal palette color for window bgnd */
  127.     short        borderstyle;    /* Style bytes for window border */
  128.     short        bordercolor;    /* Internal palette color for window border */
  129. } _windowtype;
  130. #define _WINDOWTYPE_DEFINED
  131. #endif
  132.  
  133. /* Typedef for legend definition */
  134. #ifndef _LEGENDTYPE_DEFINED
  135. typedef struct    {
  136.     short        legend;        /* TRUE=draw legend; FALSE=no legend */
  137.     short        place;        /* _PG_RIGHT, _PG_BOTTOM, _PG_OVERLAY */
  138.     short        textcolor;    /* Internal palette color for text */
  139.     short        autosize;    /* TRUE=system calculates size */
  140.     _windowtype    legendwindow;    /* Window definition for legend */
  141. } _legendtype;
  142. #define _LEGENDTYPE_DEFINED
  143. #endif
  144.  
  145. /* Typedef for legend definition */
  146. #ifndef _CHARTENV_DEFINED
  147. typedef struct    {
  148.     short        charttype;    /* _PG_BARCHART, _PG_COLUMNCHART,
  149.                     _PG_LINECHART, _PG_SCATTERCHART,
  150.                          _PG_PIECHART */
  151.     short        chartstyle;    /* Style for selected chart type */
  152.     _windowtype    chartwindow;    /* Window definition for overall chart */
  153.     _windowtype    datawindow;    /* Window definition for data part of chart */
  154.     _titletype    maintitle;    /* Main chart title */
  155.     _titletype    subtitle;    /* Chart sub-title */
  156.     _axistype    xaxis;        /* Definition for X-axis */
  157.     _axistype    yaxis;        /* Definition for Y-axis */
  158.     _legendtype    legend;        /* Definition for legend */
  159. } _chartenv;
  160. #define _CHARTENV_DEFINED
  161. #endif
  162.  
  163. /* Typedef for character bitmap */
  164. #ifndef _CHARMAP_DEFINED
  165. typedef unsigned char _charmap[8];
  166. #define _CHARMAP_DEFINED
  167. #endif
  168.  
  169. /* Typedef for pattern bitmap */
  170. #ifndef _FILLMAP_DEFINED
  171. typedef unsigned char _fillmap[8];
  172. #define _FILLMAP_DEFINED
  173. #endif
  174.  
  175. /* Typedef for palette entry definition */
  176. #ifndef _PALETTEENTRY_DEFINED
  177. typedef struct {
  178.     unsigned short    color;
  179.     unsigned short    style;
  180.     _fillmap    fill;
  181.     char        plotchar;
  182. } _paletteentry;
  183. #define _PALETTEENTRY_DEFINED
  184. #endif
  185.  
  186. /* Typedef for palette definition */
  187. #ifndef _PALETTETYPE_DEFINED
  188. typedef _paletteentry _palettetype[_PG_PALETTELEN];
  189. #define _PALETTETYPE_DEFINED
  190. #endif
  191.  
  192. /* Typedef for style sets */
  193. #ifndef _STYLESET_DEFINED
  194. typedef unsigned short _styleset[_PG_PALETTELEN];
  195. #define _STYLESET_DEFINED
  196. #endif
  197.  
  198. #ifndef __STDC__ 
  199. /* Non-ANSI names for compatibility */ 
  200. #define titletype     _titletype 
  201. #define axistype      _axistype 
  202. #define windowtype    _windowtype 
  203. #define legendtype    _legendtype 
  204. #define chartenv      _chartenv 
  205. #define charmap       _charmap 
  206. #define fillmap       _fillmap 
  207. #define paletteentry  _paletteentry 
  208. #define palettetype   _palettetype 
  209. #define styleset      _styleset 
  210. #endif 
  211.  
  212.  
  213. /* Function prototypes for charting routines    */
  214.  
  215. short __far __cdecl _pg_initchart(void);
  216. short __far __cdecl _pg_defaultchart(_chartenv __far *, short, short);
  217.  
  218. short __far __cdecl _pg_chart(_chartenv __far *, const char __far * const __far *, const float __far *, short);
  219. short __far __cdecl _pg_chartms(_chartenv __far *, const char __far * const __far *, const float __far *, short, short, short, const char __far * const __far *);
  220.  
  221. short __far __cdecl _pg_chartscatter(_chartenv __far *, const float __far *, const float __far *, short);
  222. short __far __cdecl _pg_chartscatterms(_chartenv __far *, const float __far *, const float __far *, short, short, short, const char __far * const __far *);
  223.  
  224. short __far __cdecl _pg_chartpie(_chartenv __far *, const char __far * const __far *, const float __far *, const short __far *, short);
  225.  
  226. /* Function prototypes for support routines    */
  227.  
  228. short __far __cdecl _pg_hlabelchart(_chartenv __far *, short, short, short, const char __far *);
  229. short __far __cdecl _pg_vlabelchart(_chartenv __far *, short, short, short, const char __far *);
  230.  
  231. short __far __cdecl _pg_analyzechart(_chartenv __far *, const char __far * const __far *, const float __far *, short);
  232. short __far __cdecl _pg_analyzechartms(_chartenv __far *, const char __far * const __far *, const float __far *, short, short, short, const char __far * const __far *);
  233.  
  234. short __far __cdecl _pg_analyzescatter(_chartenv __far *, const float __far *, const float __far *, short);
  235. short __far __cdecl _pg_analyzescatterms(_chartenv __far *, const float __far *, const float __far *, short, short, short, const char __far * const __far *);
  236.  
  237. short __far __cdecl _pg_analyzepie(_chartenv __far *, const char __far * const __far *, const float __far *, const short __far *, short);
  238.  
  239. short __far __cdecl _pg_getpalette(_paletteentry __far *);
  240. short __far __cdecl _pg_setpalette(const _paletteentry __far *);
  241. short __far __cdecl _pg_resetpalette(void);
  242.  
  243. void  __far __cdecl _pg_getstyleset(unsigned short __far *);
  244. void  __far __cdecl _pg_setstyleset(const unsigned short __far *);
  245. void  __far __cdecl _pg_resetstyleset(void);
  246.  
  247. short __far __cdecl _pg_getchardef(short, unsigned char __far *);
  248. short __far __cdecl _pg_setchardef(short, const unsigned char __far *);
  249.  
  250.  
  251. /* Restore default packing */
  252. #pragma pack()
  253.  
  254. #ifdef __cplusplus
  255. }
  256. #endif
  257.